﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Negocio
{
   public class Injury: PersistentObject
    {
        private DateTime date;
        private string name;
        private string description;
        private string status;
        private string type;
        private string severity;
        private string affectedArea;
        private string activityWhenInjured;
        private string cause;
        private string treatmentType;
        private string comments;
        

        public Injury()
        {
            this.Date = new DateTime();
            this.Description = "";
            this.Status = "";
            this.Type = "";
            this.Severity = "";
            this.AffectedArea = "";
            this.ActivityWhenInjured = "";
            this.Cause = "";
            this.TreatmentType = "";
            this.name="";
            this.comments = "";
        }
        public string Name 
          { 
            get{return this.name;} 
            set{this.name=value;} 
          }
       public DateTime Date 
        {
            get { return this.date;}
            set { this.date = value;}
        }
       public string ShortDate
       {
           get { return this.date.ToShortDateString(); }
       }
        public string Description 
        {
            get { return this.description;}
            set { this.description = value;}
        }

        public string Status 
        {
            get { return this.status;}
            set {this.status = value;}
        }

        public string Type 
        {
            get { return this.type;}
            set { this.type = value;}            
        }

        public string Severity 
        {
            get { return this.severity;}
            set { this.severity = value;}
        }

        public string AffectedArea 
        {
            get {return this.affectedArea;}
            set {this.affectedArea = value;}
        }

        public string ActivityWhenInjured 
        { 
            get { return this.activityWhenInjured;}
            set { this.activityWhenInjured = value;}
        }

        public string Cause 
        {
            get { return this.cause;}
            set { this.cause = value;}
        }

        public string TreatmentType 
        {
            get { return this.treatmentType;}
            set { this.treatmentType = value;}
        }

        public string Comments 
        {
            get { return comments; }
            set { comments = value; }
        }

        // override object.Equals
        public override bool Equals(object obj)
        {
            return this.Date.Equals(((Injury)obj).Date) && this.Description.Equals(((Injury)obj).Description);   
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public string Error
        {
            get
            {
                return null;
            }
        }
        public string this[string name]
        {
            get
            {
                string result = null;
                if (name == "Name")
                {
                    if (this.name == "")
                    {
                        result = "No se ha ingresado el nombre de la Lesión.";
                    }
                }
                if (name == "Description")
                {

                    if (this.description == "")
                    {
                        result = "No se ha ingresado la descripción de la Lesión.";
                    }
                }
                return result;
            }
        }
    }
}
